/*
 * Copyright (C) 2024, Ingenic Semiconductor Co.,Ltd.
 * Author: Keven <keven.ywhan@ingenic.com>
 */

#ifndef __XX_H__
#define __XX_H__

/* Boot type */
#define MMCSD_MODE_UNDEFINED	0
#define MMCSD_MODE_RAW		1
#define MMCSD_MODE_FAT		2

struct spl_image_info {
	unsigned int load_addr;
	unsigned int entry_point;
	unsigned int size;
	unsigned int flags;
};

enum {
	BOOT_DEVICE_MMC,
	BOOT_DEVICE_SFC_NOR,
	BOOT_DEVICE_SFC_NAND,
	BOOT_DEVICE_UART,
	BOOT_DEVICE_USB,
	BOOT_DEVICE_XIP,
	BOOT_DEVICE_NONE
};

static inline unsigned int spl_boot_device(void)
{
#ifdef CONFIG_SPL_MMC_SUPPORT
	return BOOT_DEVICE_MMC;
#endif
	/*When serial port download is supported, it should be directly before other downloads*/
#ifdef CONFIG_SPL_YMODEM_SUPPORT
	return BOOT_DEVICE_UART;
#endif

#ifdef CONFIG_SPL_SFC_SUPPORT
#ifdef CONFIG_SFC_NOR
	return BOOT_DEVICE_SFC_NOR;
#endif
#ifdef CONFIG_SFC_NAND
	return BOOT_DEVICE_SFC_NAND;
#endif
#endif

#ifdef CONFIG_SPL_USB_SUPPORT
	return BOOT_DEVICE_USB;
#endif
#ifdef CONFIG_SPL_XIP_SUPPORT
	return BOOT_DEVICE_XIP;
#endif
}

static inline unsigned int spl_boot_mode(void)
{
#ifdef CONFIG_SPL_FAT_SUPPORT
	return 2; /* MMCSD_MODE_FAT */
#else
	return 1; /* MMCSD_MODE_RAW */
#endif
}



#endif /* __XX_H__ */

